<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>测试调用ajax对象</title>
</head>
<body>
	测试调用ajax对象
	<script src="js/ajax.js"></script>
	<script>
		ajax({
		    url: 'http://localhost/web/public/api.web.php/web/list',
		    type: 'GET',
		    dataType: 'JSON',
		    data: {
		        // "token": "98u102a27s0aj014p1obkgv9q7",
		        // "user_id": "4"
		    },
		    onsuccess: function(ret){
		      console.log(ret)
		      render(ret)      //成功后调用render()渲染DOM
		    },
		    onerror: function(){
		      console.log('服务器异常')
		      showError()      //失败后调用showError()函数
		    }
		})
		//将数据拼装成DOM显示在页面
		function render(json){
		    
		}
		//失败后会执行什么操作
		function showError(){
		    
		}
	</script>
</body>
</html>